﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace HY.BLL.oa
{
    public class review
    {

        public static DataTable get_list()
        {
            string sqltxt = "select * from pro_list  ";

            sqltxt = sqltxt + " order by sid desc ";
            DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
            return dt;
        }



        public static DataTable get_list(string whe)
        {
            string sqltxt = "select * from pro_list where  1=1  ";
            if (whe != "") sqltxt = sqltxt + " and " + whe;

            sqltxt = sqltxt + " order by sid desc ";
            DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
            return dt;
        }


        public static DataTable get_list_group(string whe)
        {
            string sqltxt = "select retitle from pro_list group by retitle  ";
            if (whe != "") sqltxt = sqltxt + " where retitle like '%" + whe + "%'";

            sqltxt = sqltxt + " order by retitle desc ";
            DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
            return dt;
        }

        /// <summary>
        /// 最审批表    
        /// </summary>
        /// <param name="whe"></param>
        /// <returns></returns>
        public static DataTable get_list_review(string whe)
        {
            string sqltxt = "select * from leave_sub where 1=1  ";
            if (whe != "") sqltxt = sqltxt + whe ;

            sqltxt = sqltxt + " order by sid desc ";
            DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
            return dt;
        }




        public static int ins_task(string title,string ord, string usname,string role)
        {
            string sqltxt = "insert into pro_list values(N'" + title + "'," +
                                                             ord + ",N'" +
                                                             usname + "',N'"+
                                                                role+"') ";

            return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);

        }


        public static int ups_task(string title, string ord, string usname,string role,string sid)
        {
            string sqltxt = "update pro_list set retitle=N'" + title + "',reord=" +
                                                          ord + ",renm=N'" +
                                                          usname + "', role=N'"+role+"' where sid=" + sid;
            return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static int DeleteList(string sidlist)
        {
            string sqltxt = "delete pro_list where sid in(" + sidlist + ") ";
            return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);
        }

    }
}
